/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.util.ArrayList;

import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

import dao.StudentDao;
import dao.StudentDaoJTableImpl;
import entity.Student;

/**
 * 
 * @author 顾芷菱
 */
public class Modify extends javax.swing.JFrame {

	/**
	 * Creates new form modify
	 */
	public Modify() {
		initComponents();
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		jButton1 = new javax.swing.JButton();
		jLabel1 = new javax.swing.JLabel();
		jLabel2 = new javax.swing.JLabel();
		jLabel3 = new javax.swing.JLabel();
		jLabel4 = new javax.swing.JLabel();
		jLabel5 = new javax.swing.JLabel();
		jLabel6 = new javax.swing.JLabel();
		jLabel7 = new javax.swing.JLabel();
		jLabel8 = new javax.swing.JLabel();
		stuNoTextField = new javax.swing.JTextField();
		nameTextField = new javax.swing.JTextField();
		genderTextField = new javax.swing.JTextField();
		birthDateTextField = new javax.swing.JTextField();
		statusTextField = new javax.swing.JTextField();
		addressTextField = new javax.swing.JTextField();
		phoneTextField = new javax.swing.JTextField();
		dormNumTextField = new javax.swing.JTextField();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("修改信息界面");

		jButton1.setText("提交");
		jButton1.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton1ActionPerformed(evt);
			}
		});

		jLabel1.setText("姓名");

		jLabel2.setText("政治面貌");

		jLabel3.setText("出生日期");

		jLabel4.setText("性别");

		jLabel5.setText("家庭住址");

		jLabel6.setText("宿舍号");

		jLabel7.setText("学号");

		jLabel8.setText("电话");

		stuNoTextField.setText("jTextField9");

		nameTextField.setText("jTextField9");

		genderTextField.setText("jTextField9");
		genderTextField.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				genderTextFieldActionPerformed(evt);
			}
		});

		birthDateTextField.setText("jTextField9");

		statusTextField.setText("jTextField9");

		addressTextField.setText("jTextField9");

		phoneTextField.setText("jTextField9");

		dormNumTextField.setText("jTextField9");

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap(106, Short.MAX_VALUE)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addGroup(
														javax.swing.GroupLayout.Alignment.TRAILING,
														layout.createSequentialGroup()
																.addComponent(
																		jButton1)
																.addContainerGap())
												.addGroup(
														javax.swing.GroupLayout.Alignment.TRAILING,
														layout.createSequentialGroup()
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.LEADING)
																				.addGroup(
																						layout.createSequentialGroup()
																								.addGroup(
																										layout.createParallelGroup(
																												javax.swing.GroupLayout.Alignment.LEADING)
																												.addComponent(
																														jLabel1,
																														javax.swing.GroupLayout.PREFERRED_SIZE,
																														71,
																														javax.swing.GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														jLabel4,
																														javax.swing.GroupLayout.PREFERRED_SIZE,
																														71,
																														javax.swing.GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														jLabel7,
																														javax.swing.GroupLayout.PREFERRED_SIZE,
																														71,
																														javax.swing.GroupLayout.PREFERRED_SIZE))
																								.addGap(24,
																										24,
																										24)
																								.addGroup(
																										layout.createParallelGroup(
																												javax.swing.GroupLayout.Alignment.TRAILING,
																												false)
																												.addComponent(
																														nameTextField,
																														javax.swing.GroupLayout.Alignment.LEADING)
																												.addComponent(
																														genderTextField,
																														javax.swing.GroupLayout.Alignment.LEADING)
																												.addComponent(
																														stuNoTextField,
																														javax.swing.GroupLayout.PREFERRED_SIZE,
																														326,
																														javax.swing.GroupLayout.PREFERRED_SIZE)))
																				.addComponent(
																						jLabel6,
																						javax.swing.GroupLayout.PREFERRED_SIZE,
																						71,
																						javax.swing.GroupLayout.PREFERRED_SIZE)
																				.addGroup(
																						layout.createSequentialGroup()
																								.addGroup(
																										layout.createParallelGroup(
																												javax.swing.GroupLayout.Alignment.LEADING)
																												.addComponent(
																														jLabel2,
																														javax.swing.GroupLayout.PREFERRED_SIZE,
																														71,
																														javax.swing.GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														jLabel5,
																														javax.swing.GroupLayout.PREFERRED_SIZE,
																														71,
																														javax.swing.GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														jLabel3,
																														javax.swing.GroupLayout.PREFERRED_SIZE,
																														71,
																														javax.swing.GroupLayout.PREFERRED_SIZE)
																												.addComponent(
																														jLabel8,
																														javax.swing.GroupLayout.PREFERRED_SIZE,
																														71,
																														javax.swing.GroupLayout.PREFERRED_SIZE))
																								.addGroup(
																										layout.createParallelGroup(
																												javax.swing.GroupLayout.Alignment.TRAILING)
																												.addGroup(
																														javax.swing.GroupLayout.Alignment.LEADING,
																														layout.createSequentialGroup()
																																.addGap(24,
																																		24,
																																		24)
																																.addGroup(
																																		layout.createParallelGroup(
																																				javax.swing.GroupLayout.Alignment.LEADING)
																																				.addComponent(
																																						statusTextField,
																																						javax.swing.GroupLayout.PREFERRED_SIZE,
																																						326,
																																						javax.swing.GroupLayout.PREFERRED_SIZE)
																																				.addComponent(
																																						birthDateTextField,
																																						javax.swing.GroupLayout.PREFERRED_SIZE,
																																						326,
																																						javax.swing.GroupLayout.PREFERRED_SIZE)
																																				.addComponent(
																																						addressTextField,
																																						javax.swing.GroupLayout.PREFERRED_SIZE,
																																						326,
																																						javax.swing.GroupLayout.PREFERRED_SIZE)))
																												.addGroup(
																														layout.createSequentialGroup()
																																.addPreferredGap(
																																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																																.addGroup(
																																		layout.createParallelGroup(
																																				javax.swing.GroupLayout.Alignment.LEADING,
																																				false)
																																				.addComponent(
																																						phoneTextField)
																																				.addComponent(
																																						dormNumTextField,
																																						javax.swing.GroupLayout.PREFERRED_SIZE,
																																						326,
																																						javax.swing.GroupLayout.PREFERRED_SIZE))))))
																.addGap(86, 86,
																		86)))));
		layout.setVerticalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						javax.swing.GroupLayout.Alignment.TRAILING,
						layout.createSequentialGroup()
								.addGap(51, 51, 51)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(
														jLabel7,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE)
												.addComponent(
														stuNoTextField,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE))
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addComponent(
														nameTextField,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE)
												.addComponent(
														jLabel1,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE))
								.addGap(18, 18, 18)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.TRAILING)
												.addComponent(
														genderTextField,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE)
												.addComponent(
														jLabel4,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE))
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addGroup(
														layout.createSequentialGroup()
																.addGap(22, 22,
																		22)
																.addComponent(
																		birthDateTextField,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		25,
																		javax.swing.GroupLayout.PREFERRED_SIZE))
												.addGroup(
														layout.createSequentialGroup()
																.addGap(18, 18,
																		18)
																.addComponent(
																		jLabel3,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		25,
																		javax.swing.GroupLayout.PREFERRED_SIZE)))
								.addGap(18, 18, 18)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(
														jLabel2,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE)
												.addComponent(
														statusTextField,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE))
								.addGap(18, 18, 18)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(
														jLabel5,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE)
												.addComponent(
														addressTextField,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE))
								.addGap(18, 18, 18)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(
														jLabel8,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE)
												.addComponent(
														phoneTextField,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE))
								.addGap(18, 18, 18)
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(
														jLabel6,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE)
												.addComponent(
														dormNumTextField,
														javax.swing.GroupLayout.PREFERRED_SIZE,
														25,
														javax.swing.GroupLayout.PREFERRED_SIZE))
								.addGap(29, 29, 29).addComponent(jButton1)
								.addContainerGap()));

		pack();
	}// </editor-fold>

	private void modifyButtonActionPerformed(java.awt.event.ActionEvent evt) {

	}

	private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
		if (stuNoTextField.getText().equals("")
				&& nameTextField.getText().equals("")
				&& genderTextField.getText().equals("")
				&& birthDateTextField.getText().equals("")
				&& statusTextField.getText().equals("")
				&& addressTextField.getText().equals("")
				&& phoneTextField.getText().equals("")
				&& dormNumTextField.getText().equals("")) {
			JOptionPane.showMessageDialog(null, "信息不能为空");
		} else {
			Student student = new Student(stuNoTextField.getText(),
					nameTextField.getText(), genderTextField.getText(),
					birthDateTextField.getText(), statusTextField.getText(),
					addressTextField.getText(), phoneTextField.getText(),
					dormNumTextField.getText());
			JOptionPane.showMessageDialog(null, "修改成功");
		}
	}

	private void genderTextFieldActionPerformed(java.awt.event.ActionEvent evt) {
		// TODO add your handling code here:
	}

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main() {
		/* Set the Nimbus look and feel */
		// <editor-fold defaultstate="collapsed"
		// desc=" Look and feel setting code (optional) ">
		/*
		 * If Nimbus (introduced in Java SE 6) is not available, stay with the
		 * default look and feel. For details see
		 * http://download.oracle.com/javase
		 * /tutorial/uiswing/lookandfeel/plaf.html
		 */
		try {
			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager
					.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(Modify.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (InstantiationException ex) {
			java.util.logging.Logger.getLogger(Modify.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(Modify.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(Modify.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		}
		// </editor-fold>

		/* Create and display the form */
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new Modify().setVisible(true);
			}
		});
	}

	// Variables declaration - do not modify
	private javax.swing.JTextField addressTextField;
	private javax.swing.JTextField birthDateTextField;
	private javax.swing.JTextField dormNumTextField;
	private javax.swing.JTextField genderTextField;
	private javax.swing.JButton jButton1;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JLabel jLabel5;
	private javax.swing.JLabel jLabel6;
	private javax.swing.JLabel jLabel7;
	private javax.swing.JLabel jLabel8;
	private javax.swing.JTextField nameTextField;
	private javax.swing.JTextField phoneTextField;
	private javax.swing.JTextField statusTextField;
	private javax.swing.JTextField stuNoTextField;
	// End of variables declaration
}
